/**
 * Copyright (c) 2018 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package com.lswms.controller.admin;

import com.alibaba.fastjson.JSON;
import com.lswms.common.page.PageInfo;
import com.lswms.common.page.PageRequest;
import com.lswms.common.utils.Result;
import com.lswms.common.validator.ValidatorUtils;
import com.lswms.dto.YnPayRecordDTO;
import com.lswms.service.YnPayRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 支付记录
 */
@RestController
@RequestMapping("/api/admin/payrecord")
@Api(tags="支付记录-admin")
@Slf4j
public class AdminYnPayRecordController {
	
	@Autowired
	private YnPayRecordService ynPayRecordService;

    /**
     * 充值记录
     * @param dto
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("list")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime",value = "起始时间 ： yyyy-MM-dd HH:mm:ss",dataType = "String",paramType = "query",required = true,example = "2020-06-11 00:00:00")
            ,@ApiImplicitParam(name = "endTime",value = "结束时间 ： yyyy-MM-dd HH:mm:ss",dataType = "String",paramType = "query",required = true,example = "2020-06-11 23:59:59")
    })
    @ApiOperation("条件查询充值记录")
    public Result<PageInfo<YnPayRecordDTO>> list(PageRequest dto,String startTime,String endTime){
    	log.info("充值记录，参数：dto:{},user:{}",JSON.toJSONString(dto));
    	ValidatorUtils.validateEntity(dto);
    	PageInfo<YnPayRecordDTO> resp = ynPayRecordService.listByCondition(dto, startTime, endTime);
        return new Result<PageInfo<YnPayRecordDTO>>().ok(resp);
    }


}